package Hxw3DEngine.core.component.animation
{
	import Hxw3DEngine.core.display.Rectangle3D;
	import Hxw3DEngine.core.Resource.animation.UVAnimationClip;
	import Hxw3DEngine.core.component.renderer.MeshRenderer;
	import Hxw3DEngine.core.materials.shader.DiffuseShader;
	
	import flash.utils.Dictionary;
	
	//uv动画
	public class UVAnimation extends Animation
	{
		public function UVAnimation(clip:UVAnimationClip)
		{
			super();
			super.addClip(clip);
			delay = 160;
		}
		
		//运行时更改uv数据
		override public function run():void
		{
			var frameData:Vector.<Number> = getCurrentFrameData() as Vector.<Number>;
			var meshRenderer:MeshRenderer = _object3d.getComponent(MeshRenderer) as MeshRenderer;
			(meshRenderer.material.shader as DiffuseShader).tillingOffset(frameData[2],frameData[3],frameData[0],frameData[1]);
		}
	}
}